﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace BLL
{
    public class Articles
    {
        public bool GetArticlesList(out List<Util.Article> artList)
        {
            artList = new List<Util.Article>();
            if (new DAL.Articles().GetArticlesList(out artList))
                return true;
            else
                return true;
        }

        public bool GetArticle(string id, out Util.Article art)
        {
            art = new Util.Article();
            if (new DAL.Articles().GetArticle(id, out art))
                return true;
            else
                return true;
        }

        public bool SendArticle(string title, string artBody, string username)
        {
            Util.Article art = new Util.Article();
            //тут всякие проверки на правильность вводимых данных

            art.Title = title;
            art.Date = DateTime.Now.ToString();
            art.ArticleBody = artBody;
            art.UserName = username;

            if (new DAL.Articles().SendArticle(art))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}